package com.albaba.designpattern.strategy.text_003;

import com.albaba.designpattern.strategy.text_002.Receipt;

/**
 * @Description: 上下文类，持有策略接口，觉得执行哪一个具体的策略类
 * @Author zx
 * @Date 2025/2/24 18:17
 * @Version 1.0
 */
public class ReceiptContext {

    private ReceiptHandleStrategy receiptHandleStrategy;

    public void setReceiptHandleStrategy(ReceiptHandleStrategy receiptHandleStrategy) {
        this.receiptHandleStrategy = receiptHandleStrategy;
    }

    // 调用策略类中的方法
    public void handleReceipt(Receipt receipt) {
        receiptHandleStrategy.handleReceipt(receipt);
    }

}
